package com.dcits.exception;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.stream.Collectors;

public class ParamException extends RuntimeException {
    @Setter
    @Getter
    private String code;

    public ParamException(String message) {
        super(message);
    }

    /**
     * Instantiates a new Business exception.
     *
     * @param errorCode          the error code
     * @param errorMessageParams the error message params
     */
    public ParamException(ErrorCode errorCode, Object... errorMessageParams) {
        super(Arrays.stream(errorMessageParams).map(Object::toString).collect(Collectors.joining(", ")));
        this.code = errorCode.getErrorCode();
    }

}
